#pragma once

struct ChatboxText
{
	std::string szText;
	ui32 dwColor;
};

class Chatbox : public UIElement, public Singleton<Chatbox>
{
	Texture* m_baseFrame;
	Texture* m_borderFrame;
	Texture* m_upScroll;
	Texture* m_upScrollDis;
	Texture* m_upScrollDown;
	Texture* m_downScroll;
	Texture* m_downScrollDis;
	Texture* m_downScrollDown;
	Vertex3FRHWT m_baseVertices[4];
	Vertex3FRHWT m_borderVertices[4];
	Vertex3FRHWT m_upVertices[4];
	Vertex3FRHWT m_downVertices[4];
	CFont m_text;
	std::vector<ChatboxText> m_lines;
	ui32 m_relScroll;
	bool m_upClick;
	bool m_downClick;
public:
	Chatbox();
	void Resize();
	void Draw();
	void AddText(std::string m_text, i32 texEntry = -1, ui32 dwColor = 0xFFFFFFFF);
	void MouseActivity(bool left, Vertex2F pos, bool up);
};

#define sChat (*Chatbox::GetInstance())